package com.bnz.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.bnz.mapper.UserMapper;
import com.bnz.pojo.User;
import com.bnz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;

	//1. 查找所有用户
	@Override
	public List<User> findAll() {
		List<User> users = userMapper.selectByExample(null);
		return users;
	}

	//2. 添加
	@Override
	public void add(User user) {
		userMapper.insert(user);
		System.out.println("user.getId() = " + user.getId());
	}
}
